package model;

/**
 * this class represents a figure move
 */
public class Move implements Positions {

    /**
     * the number of the move in its game
     */
    private int number;

    /**
     * the date then the move occurred
     */
    private String date;

    /**
     * the start position of the moving figure, the position constants from positions interface are intended for this
     */
    private String startField;

    /**
     * the end position of the moving figure, the position constants from positions interface are intended for this
     */
    private String endField;

    /**
     * true if the move is a castling
     */
    private boolean castling;

    /**
     * true if the move is a check
     */
    private boolean checked;

    /**
     * true if the move is a checkmate
     */
    private boolean checkmate;

    /**
     * true if the move is a en passant
     */
    private boolean enPassant;

    /**
     * constructor of the move class
     */
    public Move()
    {

    }

    /**
     * gets the date of this move in this format: dd.mm.yyyy
     * 
     * @return the formatted date
     */
    public final String getFormattedDate()
    {
	StringBuilder ret = new StringBuilder();
	String[] dateinfo = this.date.substring( 0, 10 ).split( "-" );
	ret.append( dateinfo[2] );
	ret.append( '.' );
	ret.append( dateinfo[1] );
	ret.append( '.' );
	ret.append( dateinfo[0] );

	return ret.toString();
    }

    /**
     * getter of number
     * 
     * @return the number
     */
    public final int getNumber()
    {
	return this.number;
    }

    /**
     * setter of number
     * 
     * @param number
     *            the number to set
     */
    public final void setNumber( int number )
    {
	this.number = number;
    }

    /**
     * getter of date
     * 
     * @return the date
     */
    public final String getDate()
    {
	return this.date;
    }

    /**
     * setter of date
     * 
     * @param date
     *            the date to set
     */
    public final void setDate( String date )
    {
	this.date = date;
    }

    /**
     * getter of startField
     * 
     * @return the startField
     */
    public final String getStartField()
    {
	return this.startField;
    }

    /**
     * setter of startField
     * 
     * @param startField
     *            the startField to set
     */
    public final void setStartField( String startField )
    {
	this.startField = startField;
    }

    /**
     * getter of endField
     * 
     * @return the endField
     */
    public final String getEndField()
    {
	return this.endField;
    }

    /**
     * setter of endField
     * 
     * @param endField
     *            the endField to set
     */
    public final void setEndField( String endField )
    {
	this.endField = endField;
    }

    /**
     * getter of castling
     * 
     * @return the castling
     */
    public final boolean isCastling()
    {
	return this.castling;
    }

    /**
     * setter of castling
     * 
     * @param castling
     *            the castling to set
     */
    public final void setCastling( boolean castling )
    {
	this.castling = castling;
    }

    /**
     * getter of checked
     * 
     * @return the checked
     */
    public final boolean isChecked()
    {
	return this.checked;
    }

    /**
     * setter of checked
     * 
     * @param checked
     *            the checked to set
     */
    public final void setChecked( boolean checked )
    {
	this.checked = checked;
    }

    /**
     * getter of checkmate
     * 
     * @return the checkmate
     */
    public final boolean isCheckmate()
    {
	return this.checkmate;
    }

    /**
     * setter of checkmate
     * 
     * @param checkmate
     *            the checkmate to set
     */
    public final void setCheckmate( boolean checkmate )
    {
	this.checkmate = checkmate;
    }

    /**
     * getter of enPassant
     * 
     * @return the enPassant
     */
    public final boolean isEnPassant()
    {
	return this.enPassant;
    }

    /**
     * setter of enPassant
     * 
     * @param enPassant
     *            the enPassant to set
     */
    public final void setEnPassant( boolean enPassant )
    {
	this.enPassant = enPassant;
    }

}
